package com.enlorenz.common.geo.gts;

import com.enlorenz.util.DataDetUtil;

/**
 * 默认格式化
 * @author Karma
 */
public class DefaultGtsFormatter implements IGtsFormatter{
	//分割符
	private String splitSymbol=" ";
	public String getSplitSymbol() {
		return splitSymbol;
	}
	public void setSplitSymbol(String splitSymbol) {
		this.splitSymbol = splitSymbol;
	}
	
	@Override
	public String format(GtsResult gtsResult) {
		StringBuilder addr=new StringBuilder(512);
		addr.append(gtsResult.getProvince());
		addr.append(splitSymbol);
		addr.append(gtsResult.getCity());
		addr.append(splitSymbol);
		addr.append(gtsResult.getTown());
		addr.append(splitSymbol);
		addr.append(gtsResult.getStreet());
		//取第一个地址
		if(!DataDetUtil.isCollectionEmpty(gtsResult.getPlaceList())){
			addr.append(splitSymbol);
			addr.append(gtsResult.getPlaceList().get(0));
		}
		
		return addr.toString();
	}

}
